package com.vulgar.discovery;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author peng.yuan
 * @see
 * @since 2019-02-26
 */
@EnableDiscoveryClient
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Slf4j
    @RestController
    static class TestController {

        @GetMapping("/hello")
        public String hello(@RequestParam String name) {
            log.info("invoked name = {}", name);
            return "hello " + name;
        }

        @PostMapping("/post_test/{name}")
        public String postTest(@PathVariable String name) {
            return "this is a post method, name is " + name;
        }
    }
}
